package com.wqr.service;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wqr.dao.UserStatesDao;
import com.wqr.pojo.UserStates;
import com.wqr.pojo.UserStatesExample;

@Service
public class UserStatesServiceImp implements UserStatesService{
	@Autowired
	public UserStatesDao userStatesDao;
	
	public List<UserStates> list() throws Exception {
		UserStatesExample example = new UserStatesExample();
		List<UserStates> list = userStatesDao.selectByExample(example);
		return list;
	}

	public int delectUserStates(Integer userStateId) throws Exception {
		int a = userStatesDao.deleteByPrimaryKey(userStateId);
		if(a > 0) {
			return 1;
		}else {
			return 0;
		}
	}
	public int insertUserStates(UserStates userStates) throws Exception {
		int a = userStatesDao.insertSelective(userStates);
		if(a > 0) {
			return 1;
		}else {
			return 0;
		}
	}
	public int updateUserStates(UserStates userStates) throws Exception {
		int a = userStatesDao.updateByPrimaryKey(userStates);
		if(a > 0) {
			return 1;
		}else {
			return 0;
		}
	}

	public List<UserStates> selectUserStates(UserStates userStates) throws Exception {
		List<UserStates> list = userStatesDao.selectByWhere(userStates);
		return list;
	}

	
	public List<UserStates> selectAll() throws Exception {
		List<UserStates> list = userStatesDao.selectAll();
		return list;
	}

	public UserStates selectByPrimaryKey(Integer userStateId) {
		UserStates list = userStatesDao.selectByPrimaryKey(userStateId);
		return list;
	}

	public List<UserStates> selectByWhere(UserStates userStates) throws Exception {
		List<UserStates> list = userStatesDao.selectByWhere(userStates);
		return list;
	}

}
